import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/pages/index'
import BankCardInfo from "@/pages/bankCardInfo"
import BindSuccess from "@/pages/bindSuccess"
import MyBill from "@/pages/myBill"
import ApplyAgain from "@/pages/applyAgain"
import BindPersonalInfo from "@/pages/bindPersonalInfo"
Vue.use(Router)

const router=new Router({
  routes: [
    {
      path: '/',
      name: 'index',
      component: Index,
      meta:{
        title:"超短途司机绑定"
      }
    },
    {
      path: '/bankCardInfo',
      name: 'bankCardInfo',
      component: BankCardInfo,
      meta:{
        title:"绑定银行卡信息"
      }
    },
    {
      path: '/bindSuccess',
      name: 'bindSuccess',
      component: BindSuccess,
      meta:{
        title:"绑定成功"
      }
    },
    {
      path: '/myBill',
      name: 'myBill',
      component: MyBill,
      meta:{
        title:"我的账单"
      }

    },
    {
      path: '/bindPersonalInfo',
      name: 'bindPersonalInfo',
      component: BindPersonalInfo,
      meta:{
        title:"绑定个人信息"
      }
    },
    {
      path: '/applyAgain',
      name: 'applyAgain',
      component: ApplyAgain,
      meta:{
        title:"再次申请"
      }
    },
  ]
})
router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})

export default router